<template>
  <div class="coach-schedule-container">
    <!-- 主内容区 -->
    <el-card class="main-content-card">
      <template #header>
        <div class="page-header">
          <h1>教练排班管理</h1>
          <div class="header-actions">
            <el-select v-model="selectedCoach" placeholder="选择教练" clearable style="width: 180px; margin-right: 16px;">
              <el-option
                v-for="coach in coaches"
                :key="coach.id"
                :label="coach.name"
                :value="coach.id"
              >
                <span>{{ coach.name }}</span>
                <span class="coach-type-tag">{{ getCoachTypeText(coach.type) }}</span>
              </el-option>
            </el-select>
            <el-button type="primary" @click="handleBatchSchedule">批量排班</el-button>
          </div>
        </div>
      </template>

      <!-- 愉悦的列表 -->
      <div class="happy-list-container">
        <h2>教练的闪光点</h2>
        <div class="happy-list">
          <div class="happy-item">
            <div class="happy-icon"><i class="el-icon-smile"></i></div>
            <div class="happy-content">
              <p class="happy-title">学员好评</p>
              <p class="happy-desc">李教练教学耐心细致，通过率高达95%！</p>
            </div>
          </div>
          <div class="happy-item">
            <div class="happy-icon"><i class="el-icon-thumbs-up"></i></div>
            <div class="happy-content">
              <p class="happy-title">教学成就</p>
              <p class="happy-desc">王教练本月指导的学员全部通过考试！</p>
            </div>
          </div>
          <div class="happy-item">
            <div class="happy-icon"><i class="el-icon-star"></i></div>
            <div class="happy-content">
              <p class="happy-title">学员进步</p>
              <p class="happy-desc">张三学员的倒车入库技巧显著提升！</p>
            </div>
          </div>
        </div>
      </div>

    <!-- 数据统计卡片 -->
      <div class="dashboard-cards">
        <el-card class="stat-card">
          <div class="stat-content">
            <p class="stat-label">本月工作天数</p>
            <p class="stat-value">22天</p>
          </div>
        </el-card>
        <el-card class="stat-card">
          <div class="stat-content">
            <p class="stat-label">总课时</p>
            <p class="stat-value">176小时</p>
          </div>
        </el-card>
        <el-card class="stat-card">
          <div class="stat-content">
            <p class="stat-label">学员人数</p>
            <p class="stat-value">35人</p>
          </div>
        </el-card>
      </div>
      <!-- 视图切换和日期选择 -->
      <div class="view-switcher">
        <el-button-group>
          <el-button :type="viewType === 'day' ? 'primary' : ''" @click="viewType = 'day'">日视图</el-button>
          <el-button :type="viewType === 'week' ? 'primary' : ''" @click="viewType = 'week'">周视图</el-button>
          <el-button :type="viewType === 'month' ? 'primary' : ''" @click="viewType = 'month'">月视图</el-button>
        </el-button-group>
        <div class="date-picker-container">
          <el-date-picker
            v-if="viewType === 'day'"
            v-model="currentDate"
            type="date"
            placeholder="选择日期"
            style="width: 180px;"
          />
          <el-date-picker
            v-else-if="viewType === 'week'"
            v-model="currentDate"
            type="week"
            format="YYYY 第 ww 周"
            placeholder="选择周"
            style="width: 180px;"
          />
          <el-date-picker
            v-else
            v-model="currentDate"
            type="month"
            placeholder="选择月份"
            style="width: 180px;"
          />
        </div>
      </div>

      <!-- 日视图 -->
      <div v-if="viewType === 'day'" class="view-container day-view">
        <el-table :data="daySchedule" style="width: 100%" border>
          <el-table-column prop="time" label="时间段" width="120" />
          <el-table-column prop="student" label="预约学员" width="120" />
          <el-table-column prop="subject" label="培训科目" width="120" />
          <el-table-column prop="content" label="培训内容" />
          <el-table-column prop="status" label="状态" width="100">
            <template #default="scope">
              <div @click="handleViewScheduleDetail(scope.row)" style="cursor: pointer;">
                <el-tag :type="getStatusType(scope.row.status)">
                  {{ getStatusText(scope.row.status) }}
                </el-tag>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="150" fixed="right">
            <template #default="scope">
              <el-button
                v-if="scope.row.status === 'available'"
                link
                type="primary"
                @click="handleScheduleTime(scope.row)"
              >排班</el-button>
              <el-button
                v-else
                link
                type="danger"
                @click="handleCancelSchedule(scope.row)"
              >取消</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 周视图 -->
      <div v-else-if="viewType === 'week'" class="view-container week-view">
        <el-table :data="timeSlots" style="width: 100%" border>
          <el-table-column prop="time" label="时间段" width="120" fixed="left" />
          <el-table-column
            v-for="day in weekDays"
            :key="day.date"
            :label="day.label"
            width="180"
          >
            <template #default="scope">
              <div
                class="schedule-cell"
                :class="{
                  'has-schedule': hasScheduleForTimeSlot(new Date(day.date), scope.row.time),
                  'available': !hasScheduleForTimeSlot(new Date(day.date), scope.row.time)
                }"
                @click="handleCellClick(new Date(day.date), scope.row)"
              >
                <template v-if="getScheduleInfo(new Date(day.date), scope.row.time)">
                  <div class="schedule-info" @click="handleViewScheduleDetail(getScheduleInfo(new Date(day.date), scope.row.time))" style="cursor: pointer;">
                      <p class="student-name">{{ getScheduleInfo(new Date(day.date), scope.row.time)?.student }}</p>
                      <el-tag size="small" :type="getStatusType(getScheduleInfo(new Date(day.date), scope.row.time)?.status)">
                        {{ getStatusText(getScheduleInfo(new Date(day.date), scope.row.time)?.status) }}
                      </el-tag>
                    </div>
                </template>
                <template v-else>
                  <div class="available-slot">
                    <el-button link size="small">可排班</el-button>
                  </div>
                </template>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 月视图 -->
      <div v-else class="view-container month-view">
        <el-calendar v-model="currentDate" :first-day-of-week="1">
          <template #date-cell="{ date, data }">
            <div class="calendar-day-cell">
              <span class="day-number">{{ data.day.split('-').slice(-1)[0] }}</span>
              <div class="schedule-indicators">
                <div v-for="slot in getDayScheduleSlots(date)" :key="slot.time" class="schedule-indicator">
                  <el-tag
                    size="mini"
                    :type="getStatusType(slot.status)"
                    :title="`${slot.time}: ${slot.student || '空闲'}`"
                    @click="handleViewScheduleDetail(slot)"
                    style="cursor: pointer;"
                  >
                    {{ slot.student ? '已排' : '空闲' }}
                  </el-tag>
                </div>
              </div>
            </div>
          </template>
        </el-calendar>
      </div>
    </el-card>

    <!-- 排班抽屉 -->
    <el-drawer
      title="排班"
      v-model="scheduleDialogVisible"
      direction="rtl"
      size="500px"
    >
      <el-form
        ref="scheduleFormRef"
        :model="scheduleForm"
        :rules="scheduleRules"
        label-width="100px"
      >
        <el-form-item label="时间段" prop="time">
          <el-input v-model="scheduleForm.time" disabled />
        </el-form-item>
        <el-form-item label="学员" prop="student">
          <el-select v-model="scheduleForm.student" placeholder="请选择学员">
            <el-option
              v-for="student in availableStudents"
              :key="student.id"
              :label="student.name"
              :value="student.id"
            >
              <span>{{ student.name }}</span>
              <span class="student-info">{{ student.subject }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="培训科目" prop="subject">
          <el-select v-model="scheduleForm.subject" placeholder="请选择培训科目">
            <el-option label="科目二" value="subject2" />
            <el-option label="科目三" value="subject3" />
          </el-select>
        </el-form-item>
        <el-form-item label="培训内容" prop="content">
          <el-input v-model="scheduleForm.content" type="textarea" rows="3" placeholder="请输入培训内容" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="scheduleForm.remark" placeholder="请输入备注信息" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="scheduleDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitSchedule">确定</el-button>
        </span>
      </template>
    </el-drawer>

    <!-- 预约详情抽屉 -->
    <el-drawer
      title="预约详情"
      v-model="scheduleDetailDialogVisible"
      direction="rtl"
      size="600px"
    >
      <div class="schedule-detail-container">
        <div class="detail-item">
          <span class="detail-label">时间段:</span>
          <span class="detail-value">{{ selectedScheduleDetail.time }}</span>
        </div>
        <div class="detail-item">
          <span class="detail-label">学员:</span>
          <span class="detail-value">{{ getStudentName(selectedScheduleDetail.student) }}</span>
        </div>
        <div class="detail-item">
          <span class="detail-label">培训科目:</span>
          <span class="detail-value">{{ selectedScheduleDetail.subject === 'subject2' ? '科目二' : '科目三' }}</span>
        </div>
        <div class="detail-item">
          <span class="detail-label">培训内容:</span>
          <span class="detail-value">{{ selectedScheduleDetail.content }}</span>
        </div>
        <div class="detail-item">
          <span class="detail-label">状态:</span>
          <span class="detail-value">
            <el-tag :type="getStatusType(selectedScheduleDetail.status)">
              {{ getStatusText(selectedScheduleDetail.status) }}
            </el-tag>
          </span>
        </div>
        <div class="detail-item">
          <span class="detail-label">备注:</span>
          <span class="detail-value">{{ selectedScheduleDetail.remark || '无' }}</span>
        </div>
        <div class="detail-item">
          <span class="detail-label">教练:</span>
          <span class="detail-value">{{ getCoachName(selectedCoach) }}</span>
        </div>
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="scheduleDetailDialogVisible = false">关闭</el-button>
          <el-button type="primary" @click="handleEditSchedule">编辑</el-button>
        </span>
      </template>
    </el-drawer>

    <!-- 批量排班对话框 -->
    <el-dialog
      title="批量排班"
      v-model="batchScheduleDialogVisible"
      width="600px"
    >
      <el-form
        ref="batchScheduleFormRef"
        :model="batchScheduleForm"
        :rules="batchScheduleRules"
        label-width="120px"
      >
        <el-form-item label="日期范围" prop="dateRange">
          <el-date-picker
            v-model="batchScheduleForm.dateRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          />
        </el-form-item>
        <el-form-item label="工作时段" prop="workingHours">
          <el-checkbox-group v-model="batchScheduleForm.workingHours">
            <el-checkbox value="morning">上午（8:00-12:00）</el-checkbox>
            <el-checkbox value="afternoon">下午（14:00-18:00）</el-checkbox>
            <el-checkbox value="evening">晚上（19:00-21:00）</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <el-form-item label="工作日" prop="workingDays">
          <el-checkbox-group v-model="batchScheduleForm.workingDays">
            <el-checkbox value="1">周一</el-checkbox>
            <el-checkbox value="2">周二</el-checkbox>
            <el-checkbox value="3">周三</el-checkbox>
            <el-checkbox value="4">周四</el-checkbox>
            <el-checkbox value="5">周五</el-checkbox>
            <el-checkbox value="6">周六</el-checkbox>
            <el-checkbox value="0">周日</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="batchScheduleDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitBatchSchedule">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, computed, onMounted } from 'vue'
import { ElMessage } from 'element-plus'

defineEmits([])

// 确保组件挂载后再执行可能导致问题的操作
onMounted(() => {
  // 这里可以添加初始化逻辑
})

// 视图类型
const viewType = ref('week')
const currentDate = ref(new Date())

// 选中的教练
const selectedCoach = ref('')

// 教练列表
const coaches = ref([
  { id: '1', name: '李教练', type: 'subject2' },
  { id: '2', name: '王教练', type: 'subject3' }
])

// 日程数据
const daySchedule = ref([
  { time: '08:00-10:00', student: '', subject: '', content: '', status: 'available' },
  { time: '10:00-12:00', student: '张三', subject: '科目二', content: '倒车入库', status: 'scheduled' },
  { time: '14:00-16:00', student: '李四', subject: '科目二', content: '侧方停车', status: 'in_progress' },
  { time: '16:00-18:00', student: '', subject: '', content: '', status: 'available' },
  { time: '19:00-21:00', student: '王五', subject: '科目二', content: '直角转弯', status: 'completed' }
])

// 时间段
const timeSlots = ref([
  { time: '08:00-10:00' },
  { time: '10:00-12:00' },
  { time: '14:00-16:00' },
  { time: '16:00-18:00' },
  { time: '19:00-21:00' }
])

// 周视图日期
const weekDays = computed(() => {
  const days = []
  const date = new Date(currentDate.value)
  const initialDate = new Date(date)
  initialDate.setDate(initialDate.getDate() - initialDate.getDay() + (initialDate.getDay() === 0 ? -6 : 1)) // 周一为每周第一天
  
  for (let i = 0; i < 7; i++) {
    const dayDate = new Date(initialDate)
    days.push({
      date: dayDate,
      label: `${dayDate.getMonth() + 1}/${dayDate.getDate()}\n${['一', '二', '三', '四', '五', '六', '日'][i]}`
    })
    initialDate.setDate(initialDate.getDate() + 1)
  }
  
  return days
})

// 可选学员
const availableStudents = ref([
  { id: '1', name: '张三', subject: '科目二' },
  { id: '2', name: '李四', subject: '科目二' },
  { id: '3', name: '王五', subject: '科目三' }
])

// 排班对话框
const scheduleDialogVisible = ref(false)
const batchScheduleDialogVisible = ref(false)
const scheduleFormRef = ref(null)
const scheduleForm = ref({
  time: '',
  student: '',
  subject: '',
  content: '',
  remark: ''
})

// 批量排班对话框
const batchScheduleFormRef = ref(null)
const batchScheduleForm = ref({
  dateRange: [],
  workingHours: [],
  workingDays: []
})

// 表单验证规则
const scheduleRules = {
  student: [{ required: true, message: '请选择学员', trigger: 'change' }],
  subject: [{ required: true, message: '请选择培训科目', trigger: 'change' }],
  content: [{ required: true, message: '请输入培训内容', trigger: 'blur' }]
}

const batchScheduleRules = {
  dateRange: [{ required: true, message: '请选择日期范围', trigger: 'change' }],
  workingHours: [{ required: true, message: '请选择工作时段', trigger: 'change' }],
  workingDays: [{ required: true, message: '请选择工作日', trigger: 'change' }]
}

// 获取教练类型文本
const getCoachTypeText = (type) => {
  const typeMap = {
    'subject2': '科目二教练',
    'subject3': '科目三教练',
    'theory': '理论教练'
  }
  return typeMap[type] || type
}

// 获取状态类型
const getStatusType = (status) => {
  const typeMap = {
    'available': '',
    'scheduled': 'info',
    'in_progress': 'warning',
    'completed': 'success',
    'cancelled': 'danger'
  }
  return typeMap[status] || ''
}

// 获取状态文本
const getStatusText = (status) => {
  const textMap = {
    'available': '可排班',
    'scheduled': '已排班',
    'in_progress': '进行中',
    'completed': '已完成',
    'cancelled': '已取消'
  }
  return textMap[status] || status
}

// 获取日期的排班槽位
const getDayScheduleSlots = (date) => {
  // 模拟数据，实际应根据日期获取排班信息
  const slots = []
  if (Math.random() > 0.5) {
    slots.push({
      time: '08:00-10:00',
      student: '张三',
      status: 'scheduled'
    })
  }
  if (Math.random() > 0.5) {
    slots.push({
      time: '14:00-16:00',
      student: '李四',
      status: 'in_progress'
    })
  }
  return slots
}

// 检查时间段是否有排班
const hasScheduleForTimeSlot = (date, time) => {
  if (!(date instanceof Date)) date = new Date(date)
  return !!getScheduleInfo(date, time)
}

// 获取排班信息
const getScheduleInfo = (date, time) => {
  if (!(date instanceof Date)) date = new Date(date)
  // 这里简化处理，实际应根据日期和时间段查询排班信息
  return daySchedule.value.find(item => item.time === time && Math.random() > 0.3)
}

// 教练变更
const handleCoachChange = (value) => {
  // 实现教练变更逻辑
  ElMessage.info(`已选择教练: ${coaches.value.find(c => c.id === value)?.name}`)
}

// 排班时间段
const handleScheduleTime = (row) => {
  scheduleForm.value.time = row.time
  scheduleDialogVisible.value = true
}

// 取消排班
const handleCancelSchedule = (row) => {
  ElMessage.success('排班已取消')
  // 实现取消排班逻辑
}

// 单元格点击
const handleCellClick = (date, timeSlot) => {
  if (!hasScheduleForTimeSlot(date, timeSlot.time)) {
    scheduleForm.value.time = timeSlot.time
    scheduleDialogVisible.value = true
  }
}

// 提交排班
const submitSchedule = async () => {
  if (!scheduleFormRef.value) return
  await scheduleFormRef.value.validate((valid) => {
    if (valid) {
      // 实现提交逻辑
      ElMessage.success('排班成功')
      scheduleDialogVisible.value = false
    }
  })
}

// 批量排班
const handleBatchSchedule = () => {
  batchScheduleDialogVisible.value = true
}

// 提交批量排班
const submitBatchSchedule = async () => {
  if (!batchScheduleFormRef.value) return
  await batchScheduleFormRef.value.validate((valid) => {
    if (valid) {
      // 实现批量排班逻辑
      ElMessage.success('批量排班成功')
      batchScheduleDialogVisible.value = false
    }
  })
}

// 预约详情对话框
const scheduleDetailDialogVisible = ref(false)
const selectedScheduleDetail = ref({})

// 获取学员名称
const getStudentName = (studentId) => {
  const student = availableStudents.value.find(s => s.id === studentId)
  return student ? student.name : ''
}

// 获取教练名称
const getCoachName = (coachId) => {
  const coach = coaches.value.find(c => c.id === coachId)
  return coach ? coach.name : ''
}

// 查看预约详情
const handleViewScheduleDetail = (schedule) => {
  selectedScheduleDetail.value = { ...schedule }
  scheduleDetailDialogVisible.value = true
}

// 编辑预约
const handleEditSchedule = () => {
  scheduleDialogVisible.value = true
  scheduleForm.value = { ...selectedScheduleDetail.value }
  scheduleDetailDialogVisible.value = false
}
</script>

<style scoped>
/* 全局样式 */
.coach-schedule-container {
  padding: 20px;
  background-color: #f0f2f5;
  min-height: calc(100vh - 60px);
}

/* 页面标题样式 */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: #333;
}

.header-actions {
  display: flex;
  align-items: center;
}

/* 愉悦的列表样式 */
.happy-list-container {
  margin-bottom: 24px;
  padding: 20px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.happy-list-container:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.happy-list-container h2 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.happy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.happy-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: #fff9f0;
  border-radius: 8px;
  border-left: 4px solid #ff9a3c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  transition: all 0.3s ease;
}

.happy-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.happy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: 16px;
  background-color: #fff;
  border-radius: 50%;
  color: #ff9a3c;
  font-size: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.happy-content {
  flex: 1;
}

.happy-title {
  margin: 0;
  margin-bottom: 4px;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

.happy-desc {
  margin: 0;
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}

/* 统计卡片样式 */
.dashboard-cards {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 150px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.12);
}

.stat-content {
  text-align: center;
  padding: 20px 0;
}

.stat-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

/* 主内容区样式 */
.main-content-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow: hidden;
}

/* 视图切换样式 */
.view-switcher {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
  background-color: #fff;
}

.date-picker-container {
  display: flex;
  align-items: center;
}

/* 视图容器样式 */
.view-container {
  padding: 0 20px 20px;
}

/* 日视图样式 */
.day-view .el-table th,
.day-view .el-table td {
  text-align: center;
}

.day-view .el-table {
  border-radius: 8px;
  overflow: hidden;
}

/* 周视图样式 */
.week-view .schedule-cell {
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.week-view .schedule-cell.has-schedule {
  background-color: #f0f7ff;
}

.week-view .schedule-cell.available {
  background-color: #f7f7f7;
}

.week-view .schedule-cell:hover {
  background-color: #e6f7ff;
  transform: scale(1.02);
}

.week-view .schedule-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 5px;
}

.week-view .student-name {
  font-size: 12px;
  margin: 0;
  font-weight: 500;
}

/* 月视图样式 */
.month-view .calendar-day-cell {
  height: 80px;
  display: flex;
  flex-direction: column;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.month-view .calendar-day-cell:hover {
  background-color: #f5f7fa;
}

.month-view .day-number {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

.month-view .schedule-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.month-view .schedule-indicator {
  width: 100%;
}

/* 预约详情样式 */
.schedule-detail-container {
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.detail-item {
  display: flex;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.detail-label {
  width: 100px;
  color: #999;
  font-size: 14px;
  font-weight: 500;
}

.detail-value {
  flex: 1;
  color: #333;
  font-size: 14px;
}

/* 其他样式 */
.coach-type-tag {
  margin-left: 8px;
  font-size: 12px;
  color: #666;
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
}

.student-info {
  margin-left: 8px;
  font-size: 12px;
  color: #666;
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
}

.available-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

/* 响应式样式 */
@media (max-width: 1200px) {
  .stat-card {
    flex: 1 1 30%;
    min-width: 120px;
  }
}

@media (max-width: 992px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }
  .view-switcher {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .stat-card {
    flex: 1 1 100%;
  }
  .happy-item {
    min-width: 100%;
  }
}
</style>